﻿using LeEdu.DAL.DataAccess;
using LeEdu.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LeEdu.Service
{
    public class FileService
    {
        private FileDal fileDal;
        public FileService()
        {
            fileDal = new FileDal();
        }

        public bool Add(File file)
        {
            return fileDal.Insert(file);
        }

        public List<File> List(Guid cid)
        {
            return fileDal.SelectListByCourseId(cid);
        }
        public File SelectFileByFileId(Guid cid)
        {
            return fileDal.SelectFileByFileId(cid);
        }
        /// <summary>
        /// 根据课程Id和文件类型查询文件列表
        /// </summary>
        /// <param name="cid"></param>
        /// <returns></returns>
        public List<File> SelectListByCourseIdAndDocType(Guid cid)
        {
            return fileDal.SelectListByCourseIdAndDocType(cid);
        }

        public bool Edit(File file)
        {
            return fileDal.Update(file);
        }
    }
}
